package com.pactera.demo.social.qq.config;

import com.pactera.demo.config.SecurityProperties;
import com.pactera.demo.social.SocialAutoConfigurerAdapter;
import com.pactera.demo.social.qq.connet.QQConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.social.connect.ConnectionFactory;

/**
 * <p>
 *
 * </p>
 *
 * @author chang.zhou
 * @version version
 * @date Created in 2020/3/4 19:49
 */
@Configuration
@ConditionalOnProperty(value = "demo.security.qq.app-id",name = "app-id")
public class QQAutoConfig extends SocialAutoConfigurerAdapter {

    @Autowired
    private SecurityProperties securityProperties;

    @Override
    protected ConnectionFactory<?> createConnectionFactory() {
        return new QQConnectionFactory(securityProperties.getQq().getProviderId(),
                securityProperties.getQq().getAppId(), securityProperties.getQq().getAppSecret());
    }
}
